package com.mls.fivedistrict.pojo;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.Version;
import com.baomidou.mybatisplus.enums.IdType;
import com.mls.fivedistrict.enums.GoodsOrderStatusEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * <p>
 * </p>
 *
 * @author Five Team
 * @since 2018-05-16
 */
@Data
@Accessors(chain = true)
@TableName(value = "t_goods_order", resultMap = "BaseResultMap")
public class GoodsOrder extends Model<GoodsOrder> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @NotNull(message = "商品id不能为空")
    private Long goodId;

    private Long userId;
    /**
     * 订单状态：待支付、待发货、已发货、已完成、已失效
     */
    private GoodsOrderStatusEnum status;
    /**
     * 订单编号
     */
    private String orderNo;
    /**
     * 收货手机号
     */
    @NotBlank(message = "收货人手机号不能为空")
    private String phone;
    /**
     * 收货地址
     */
    @NotBlank(message = "收货地址不能为空")
    private String shippingAddress;
    private Date createDate;
    private Date updateDate;
    @TableLogic
    private Boolean isDelete;
    @Version
    private Integer version;
    /**
     * 物流单号
     */
    private String trackingNumber;
    /**
     * 物流公司名称
     */
    private String trackingName;
    /**
     * 物流公司ID
     */
    private Long logisticsId;
    /**
     * 折扣
     */
    private BigDecimal discount;
    /**
     * 折后价
     */
    private BigDecimal discountPrice;
    /**
     * 订单价格
     */
    @NotNull(message = "订单价格不能为空")
    private BigDecimal price;

    /**
     * 收货人
     */
    private String consignee;


    private transient GoodsOrderPayIntegral goodsOrderPayIntegral;
    private transient Goods goods;

    public Boolean getIsDelete() {
        return isDelete;
    }

    public Boolean getDelete() {
        return isDelete;
    }

    public void setDelete(Boolean delete) {
        isDelete = delete;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
